#!/usr/bin/envpython
# -*-coding:UTF-8-*-
'''
@File    :   menu_updateRoleMenu.py
@Contact :   308711822@qq.com
@License :   (C) Copyright 2021-2225, Personal exclusive right.

@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2023/5/31 21:57   小钟同学      1.0         None
'''

from infirmary_admin_src.infirmary_common.infirmary_controller import IBaseController
from infirmary_admin_src.infirmary_common.infirmary_controller.rest_controller_with_depends import \
    RestControllerWithDepends
from fastapi import Request, Depends, Path

from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.schemas import SchemaBase
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.role.services import RoleBusinesses



class XParam(SchemaBase):
    '''
    账号密码登录参数
    '''
    roleId: int
    menuIdList: list[int]


class IController(IBaseController):
    '''
    定制相关约束检测函数逻辑步序
    '''

    def __init__(self, *, request: Request,
                 schema_param: XParam,
                 ):
        super().__init__(request=request)
        # 入参参数
        # 入参参数
        self.schema_param = schema_param


@RestControllerWithDepends()
class SystemMenuUpdateRoleMenuController(IController):

    def business_login(self):
        pass

        # 菜单树列表信息
        # if self.schema_param.roleId == 1:
        #     pass
        #     self.response_ok = False
        #     self.response_msg = '技术总监或管理人员不需要修改'
        #     return None
        isok = RoleBusinesses.updata_sys_role_and_menu(role_id=self.schema_param.roleId,
                                                       menuIdList=self.schema_param.menuIdList,
                                                       )
        return isok
